/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package _4_Mapper;

import _3_Object.ChangePasswordObject;
import _5_DB.ConnectDB;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 *
 * @author DOM
 */
public class ChangePasswordMapper {
    public static int change(ChangePasswordObject c)
    {
         int retval = -1;
        try{
            ConnectDB db = new ConnectDB();
            Connection con = db.getConnection();
            
            CallableStatement proc = null;
            proc = con.prepareCall("{call procDoiMatKhau(?,?,?)}");
            
            proc.setInt(1, c.getuID());
            proc.setString(2, c.getOldpass());
            proc.setString(3, c.getNewpass());
            
            
           retval = proc.executeUpdate();
        }
            catch(SQLException ex)
            {
            }
        return retval;
        }
    }
